package com.itheima.test.UDP.broadcast;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class Service1 {
    public static void main(String[] args) throws IOException {
        //创建码头和新包裹
        DatagramSocket socket =new DatagramSocket(10000);
        DatagramPacket packet = new DatagramPacket(new byte[1024], 1024);
        //接受数据输出后释放资源
        socket.receive(packet);
        System.out.println(new String(packet.getData(),0, packet.getLength()));
        socket.close();
    }
}
